package la.bbs558.controller.admin;

import cn.dev33.satoken.annotation.SaCheckRole;
import la.bbs558.controller.base.Result;
import la.bbs558.satoken.StpAdminUtil;
import la.bbs558.service.StatisticsManageService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: Shanks
 * @date: 2024/1/12 14:52
 * @desc:
 */
@RestController
@RequestMapping("/admin/statistic")
@SaCheckRole(value = { "admin" },type = StpAdminUtil.TYPE)
public class StatisticsManageController {

    @Resource
    private StatisticsManageService statisticsManageService;

    @GetMapping("/todayVisitCount")
    public Result<?> todayVisitCount() {
        return Result.success(statisticsManageService.getTodayVisitCount());
    }

    @GetMapping("/todayVisitUserCount")
    public Result<?> todayVisitUserCount() {
        return Result.success(statisticsManageService.getTodayVisitUserCount());
    }

    @GetMapping("/todayVisitUserRetention")
    public Result<?> todayVisitUserRetention() {
        return Result.success(statisticsManageService.todayVisitUserRetention());
    }

    @GetMapping("/addVisitCount")
    public Result<?> addUserCount() {
        return Result.success(statisticsManageService.addUserCount());
    }

    @GetMapping("/userVisitCount")
    public Result<?> userVisitCount() {
        return Result.success(statisticsManageService.userVisitCount());
    }
}
